<?php
    //注册
	$yonghumingzc = $_POST['yonghumingzc'];
	$mimazc = $_POST['mimazc'];
	$mima2zc = $_POST['mima2zc'];
	$QQzc=$_POST['QQzc'];
	if($yonghumingzc!=NULL and $mimazc!=NULL and $mima2zc!=NULL and $QQzc!=NULL)
	{
		error_reporting(0);//关闭提示
		$s = $_GET['s'];
		$yonghumingzc=str_ireplace("<","&lt;",$yonghumingzc);//转义
		$yonghumingzc=str_ireplace(">","&gt;",$yonghumingzc);
		$mimazc=str_ireplace("<","&lt;",$mimazc);//转义
		$mimazc=str_ireplace(">","&gt;",$mimazc);
		$mima2zc=str_ireplace("<","&lt;",$mima2zc);//转义
		$mima2zc=str_ireplace(">","&gt;",$mima2zc);
		//链接数据库
		require_once('./config.php');
		$con=login();
		if (!$con)
		{
			die('MYSQL链接失败: ' . mysqli_error());
		}
		else
		{
			if ($yonghumingzc!=NULL and $mimazc!=NULL and $mima2zc==$mimazc and $mima2zc!=NULL and $QQzc!=NULL) 
			{
				$sql="INSERT INTO user(用户名,密码,QQ) VALUES('$yonghumingzc','$mimazc','$QQzc')";
				mysqli_query($con,$sql);
				echo '<script> alert("注册成功");history.back(); </script>';
			}
			elseif($s==2 and( $yonghumingzc==NULL or $mimazc==NULL or $mima2zc==NULL))
			{
				echo '<script> alert("注册失败，请检查输入内容");history.back(); </script>';
			}
		}
	}
?>
